<?php
include_once('common/header.php');
$intNewsId		= $objRequest->getParam('newsid', 0);
$intPage		= $objRequest->getParam('page',1);
$intLimit		= COMMENT_LIMIT;
$intOff			= (($intPage-1) * $intLimit);
$strUrl			= HOST_VFRIEND . 'comment/news?newsid=' . $intNewsId . '&';
$objNews 		= new News();
$intTotal		= $objNews->getCmtTotal($intNewsId);
$arrComment		= $objNews->getCmtList($intNewsId,$intOff,$intLimit);
$strCookieKey	= COOKIE_NEWS_CMT . $intNewsId;
if($intPage > 0) {
	Vfriend_Function::setCookie($strCookieKey, $intPage);
} else {
	Vfriend_Function::deleteCookie($strCookieKey);
}
$this->view->intPage		= $intPage;
$this->view->arrComment		= $arrComment;
$this->view->intTotal		= $intTotal;
$this->view->intOffset		= $intOff;
$this->view->intLimit		= $intLimit;
$this->view->strUrl			= $strUrl;
$objView					= Zend_Registry::get('objView');
$strData					= $objView->fetch('new/box-comment.tpl');
$arrJson					= array('error'=>0, 'data'=>$strData);
echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
exit();
?>
